<form class="form-inline" method="get">
    <div class="col-xs-12">
        <button type="button" onclick="modal('{:url(\'addNews\')}', '添加新闻', '80%', '80%')" class="btn btn-success">
            添加新闻
        </button>
    </div>
</form>

<hr>

<table class="table table-striped table-bordered">
    <thead>
    <tr>
        <td>ID</td>
        <td>标题</td>
        <td>状态</td>
        <td>首页推荐</td>
        <td>排序号</td>
        <td>添加时间</td>
        <td>更新时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>
            {$item.title}
        </td>
        <td>
            {if $item["status"] eq 1}
            <label class="label label-danger">显示</label>
            {else}
            <label class="label label-success">隐藏</label>
            {/if}
        </td>
        <td>
            {if $item["is_rec"] eq 1}
            <label class="label label-danger">首推</label>
            {else}
            <label class="label label-success">否</label>
            {/if}
        </td>
        <td>{$item.display_order}</td>
        <td>
            {:date("Y-m-d H:i:s", $item.create_time)}
        </td>
        <td>
            {:date("Y-m-d H:i:s", $item.update_time)}
        </td>
        <td>
                <a href="javascript:;" onclick="modal('{:url(\'editNews\', [\'news_id\'=>$item.id])}', '编辑新闻', '80%', '80%')" class="btn btn-default">
                    编辑
                </a>
                <a href="javascript:;" data-toggle="confirm" data-title="确定删除此记录？" data-url="{:url('Shop/delNews', ['news_id'=>$item.id])}" class="btn btn-default">
                    删除
                </a>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>
<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {
        $("#cate").select2({
            placeholder: "选择分类",
            allowClear: true
        });
    })
</script>
